package com.ai.controller.made;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.entity.made.RegionBase;
import com.ai.entity.made.page.RegionPage;
import com.ai.model.vo.RegionBaseVo;
import com.ai.service.made.IRegionBaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *  区域信息基础接口
 *
 * @author jiaok
 * @since 2023-07-24
 */
@RestController
@RequestMapping("/region-base")
public class RegionBaseController {

    @Resource
    private IRegionBaseService iRegionBaseService;

    @ApiOperation("分页查询")
    @PostMapping("pageList")
    @EnterPathParamLog
    public IPage<RegionBase> selectByPage(@RequestBody RegionPage page) {
        IPage<RegionBase> iPage = iRegionBaseService.getPage(page);
        return iPage;
    }

    @ApiOperation("新增区域信息")
    @PostMapping("add")
    @EnterPathParamLog
    public CommonResponse add(@RequestBody RegionBaseVo regionBaseVo) {
        return iRegionBaseService.add(regionBaseVo);
    }

    @ApiOperation("列表查询")
    @PostMapping("getList")
    @EnterPathParamLog
    public CommonResponse getList() {
       return iRegionBaseService.getList();
    }

    @ApiOperation("删除区域信息")
    @PostMapping("delete/{id}")
    @EnterPathParamLog
    public CommonResponse delete(@PathVariable(name = "id") String id) {
        return iRegionBaseService.deleteRegion(id);
    }

    @ApiOperation("更新区域信息")
    @PostMapping("update")
    @EnterPathParamLog
    public CommonResponse update(@RequestBody RegionBase regionBase) {
        return iRegionBaseService.updateRegion(regionBase);
        }


    @ApiOperation("获取指定区域信息")
    @PostMapping("getAppoint/{id}")
    @EnterPathParamLog
    public CommonResponse getAppoint(@PathVariable(name = "id") String id) {
        return iRegionBaseService.getAppoint(id);
    }
}